import platform
import time

from xjlibrary.mprocesspoll.process_distributed.BaseTask import BaseTask
from xjlibrary.network.MyIP import get_local_ip,GetLocalIPByPrefix


class SendTask(BaseTask):
    def __init__(self):
        super().__init__()
        sysstr = platform.system()
        if sysstr == "Windows":
            self.ip = GetLocalIPByPrefix("192.168.40")
        else:
            self.ip = get_local_ip("enp2s0")
        self.port = 5000
        self.init_send(self.ip, self.port)


if __name__ == "__main__":
    send = SendTask()
    send.start()
    send.set_task_result_obj()
    i = 0
    while 1:
        for _ in range(1000):
            i = i + 1
            send.set_task(i)
        time.sleep(60)
